import React, { useState, useMemo } from "react"

export default () => {
    const [count, setCount] = useState(0)
    const memorizedText = useMemo(() => {
        console.log("run useMemo function");
        return `this is a memorized text ${Date.now()}`;
    }, [Math.floor(count / 10)])
    return (
        <div>
            {memorizedText}
            <p>You click {count} times</p>
            <button onClick={() => { setCount(count + 1) }}></button>
        </div>
    )
}